﻿using DataAccess;
using Model.CustomDataType;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace BusinessLogic
{
    public class MyQueryBL: MarshalByRefObject
    {
        private MyQueryDA myQueryDA;
        public override object InitializeLifetimeService()
        {
            return null;
        }
        public MyQueryBL()
        {
            myQueryDA = new MyQueryDA();   
        }
        /// <summary>
        /// Get data from custom query.
        /// Note: Use "<<_>>" as a token.
        /// Example:
        /// string[] temp = q.doQuery("select dateofbirth, sex, patientid from patient");
        /// 
        /// string[] re = s.Split(new string[] { "<<_>>" }, StringSplitOptions.None);
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public string[] doQuery(string query)
        {
            return myQueryDA.doQuery(query);
        }
        /// <summary>
        /// Excute a custom non-query
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public bool doNonQuery(string query)
        {
            return myQueryDA.doNonQuery(query);
        }

        public CMDateTime getCurrentDateTime()
        {
            return new CMDateTime();
        }
        public CMDateTime getCMDateTime(int year, int month, int day)
        {
            return new CMDateTime(day, month, year);
        }
        public CMDateTime getFullCMDateTime(int year, int month, int day, int hour, int minute, int second)
        {
            return new CMDateTime(day, month, year, hour, minute, second);
        }

    }
}
